<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8"/>
    <title>Vue 3 组件嵌套</title>
</head>
<body>
<div id="app">
    <my-counter></my-counter>
</div>

<script src="/assets/vue/vue3.js"></script>
<script src="/site/js/component/counter.js"></script>
<script src="/site/js/component/my-counter.js"></script>
<script>
    const { createApp, onMounted } = Vue;

    const app = createApp({
        components: {
            MyCounter // 局部注册组件
        },
        setup() {
            // 可以在这里添加更多逻辑
            onMounted(() => {
                console.log('组件已挂载');
            });
        },

    });

    app.mount('#app'); // 挂载到 DOM
</script>
</body>
</html>
